#! /usr/bin/env python

#############################################################################
##                                                                         ##
##                                                                         ##
##                                                                         ##
## metatunnel use 198.18.0.0/15 (IANA Benchmark test range) to assure      ##
##    no conflicts with public or private nets                             ##
#############################################################################


import os, sys
from fcntl import ioctl
from scapy import *
from base64 import b64encode
sys.path.append("lib/") 
from router import *
from ConfigParser import ConfigParser

conf=ConfigParser()
metarouter = router()
metarouter.start()

# Load all devconf files and bring up virtualdevices

conf.read("./etc/virtualdevices.conf")
for devicename in conf.sections():
	deviceparameters = {}
	for option in conf.options(devicename):
		deviceparameters[option] = conf.get(devicename, option)
	
	if not metarouter.addvirtualdevice(devicename, deviceparameters):
		print "Error bringing up iface", devicename


